<script setup lang="ts">
  import {useSystemStore} from '~/store/system'
// import {watch,reactive} from 'vue'
  // import {getLangType} from './utils/language'
  import {GlobalThemeOverrides,
    // zhCN,enUS,jaJP, dateZhCN,dateEnUS,dateJaJP
  } from 'naive-ui'

  // 获取网站元数据信息
  const systemStore = useSystemStore()
  try {
    const res = await request('/actuator/info', {
      method: 'GET',
      server: true,
      key: 'siteInfo'
    })
    systemStore.siteInfo = res.data.value
  } catch (e) {
    throwError(e.message)
  }

  // const { locale } = useI18n()
  // const localeData = reactive({
  //   dateLocale: null,
  //   locale: null
  // })
  // watch([locale], (o,n) => {
  //   setLocaleLang()
  // })
  // function setLocaleLang () {
  //   const initlangType = getLangType()
  //   // console.log('lang->', initlangType)
  //   switch (initlangType) {
  //     case 'zh':
  //       localeData.locale = zhCN
  //       localeData.dateLocale = dateZhCN
  //       break;
  //     case 'en':
  //       localeData.locale = enUS
  //       localeData.dateLocale = dateEnUS
  //       break;
  //     case 'ja':
  //       localeData.locale = jaJP
  //       localeData.dateLocale = dateJaJP
  //       break;
  //   }
  // }
  // setLocaleLang()
  const themeOverrides: GlobalThemeOverrides = {
    common: {
      // baseColor: '#335fab',
      // primaryColor: '#335fab'
    },
    Button: {
      textColor: '#6a4e87',
      textColorHover: '#796293FF',
      textColorFocus: '#6a4e87',
      border: '1px solid #6a4e87',
      borderPressed: '1px solid #6a4e87',
      borderFocus: '1px solid #6a4e87',
      borderHover: '1px solid #6a4e87'
    },
    Tabs: {
      tabFontSizeCard: '14px',
      tabTextColorLine: '#6a4e87',
      tabTextColorActiveLine: '#796293FF',
      tabTextColorHoverLine: '#6a4e87',
      barColor: '#796293FF'
    }
  }
</script>

<template>
<!--  <n-config-provider -->
<!--    :locale="localeData.locale" -->
<!--    :date-locale="localeData.dateLocale" -->
<!--    :theme-overrides="themeOverrides" inline-theme-disabled>-->
<!--    <NuxtLayout>-->
<!--      <NuxtPage />-->
<!--    </NuxtLayout>-->
<!--  </n-config-provider>-->
    <n-config-provider
      :theme-overrides="themeOverrides" inline-theme-disabled>
      <NuxtLayout>
        <NuxtPage />
      </NuxtLayout>
    </n-config-provider>
</template>

<style lang="scss">
  @font-face{
    font-family:"Micro";
    src:url('@/assets/fonts/MicroExtendFLF.ttf');
  }

  body, html {
    -webkit-font-smoothing: unset!important;
    font-family: -apple-system,system-ui,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,Helvetica Neue,PingFang SC,Hiragino Sans GB,Microsoft YaHei;
  }

  html {
    word-break: break-word;
    text-rendering: optimizeLegibility;
    color: #333131;
  }

  article, aside, details, figcaption, figure, footer, header, main, menu, nav, section {
    display: block;
  }

  .button, button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #6a4e87;
    color: #fff;
    border-radius: 2px;
    border: none;
    padding: .5rem 1.3rem;
    outline: none;
    transition: background-color .3s,color .3s;
    cursor: pointer;
  }
  a, button, input {
    margin: initial;
  }
  [type=reset], [type=submit], button, html [type=button] {
    -webkit-appearance: button;
  }
  button, select {
    text-transform: none;
  }
  button, input {
    overflow: visible;
  }
  button, input, select, textarea {
    font: inherit;
    margin: 0;
  }

  body {
    --tidy-layer-4-dropdown:#fff;
    --tidy-font-4:#c2c8d1;
    --tidy-layer-3-fill:#f2f3f5;
    --tidy-gray-3: #f7f8fa;
    --tidy-layer-5: #fff;
    --tidy-layer-1: #fff;
    --tidy-font-white: #fff;
    --tidy-font-1:#252933;
    --tidy-font-2: #515767;
    --tidy-font-3:#8a919f;
    --tidy-background: #f2f3f5;
    --tidy-navigation: #fff;
    --tidy-brand-1-normal: #6a4e87;
    --tidy-brand-2-normal: #CAC1D3FF;
    --tidy-font-brand1-normal: #6a4e87;
    --tidy-brand-5-light: #a698b5;
    --tidy-brand-6-light: #CAC1D3FF;
    --tidy-gray-1-1: #c1bdc7;
    --tidy-gray-2: #d0cece;
    --tidy-brand-2-hover:#6a4e87;
    --tidy-component-hover:#e4e6eb;
    --tidy-popup:#fff;
    --tidy-font-danger:#ff5132;
    --tidy-layer-2-1:#f7f8fa;
    overflow-y: scroll;
    background-color: var(--tidy-background);
    --tidy-brand-4-disable: #CEC7D9FF;
  }

  .container {
    position: relative;
    margin: 0 auto;
    width: 100%;
    max-width: $containerWidth;
    @include clearfix;
  }

  .container-flex {
    display: flex;
    align-items: center;
    height: 100%;
  }

  .container.large-container {
    max-width: $largeContainerWith;
  }

  a {
    text-decoration: none;
    cursor: pointer;
    color: #909090;
  }

  img {
    border-style: none;
  }

  ul,ol{
    margin:0;
    padding:0;
  }

  ul,ol,li {
    list-style-type: none;
  }

  .hidden {
    display: none;
  }

  .thumb {
    flex: 0 0 auto;
    width: 120px;
    height: 80px;
    margin-left: 24px;
    border-radius: 2px;
  }

  .logo {
    margin-right: 12px;
    margin-left: 24px;
    display: inline-block;
    height: 22px;
    width: auto;
    padding: 19px 0 19px;
  }

  .logo-img {
    display: block;
    width: 107px;
    height: 22px;
  }

  .logo-img-mobile {
    display: none;
    width: 31px;
  }


  .nav-item {
    position: relative;
    cursor: pointer;
  }
  .nav-item {
    position: relative;
    cursor: pointer;
  }
  .nav-item {
    color: #86909c;
    padding: 0 12px;
    font-size: 14px;
    margin: 0;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
  }
  .nav-item.link-item {
    padding: 0;
    height: 60px;
  }
  .nav-item a {
    color: var(--tidy-font-2);
    position: relative;
    @include expand-click-range;
  }
  .nav-item.search {
    cursor: auto;
    padding-left: 0;
  }

  .search-add {
    flex: 1 1 auto;
    height: 60px;
    display: flex;
    justify-content: flex-end;
  }
  .search-add-ul {
    display: flex;
    justify-content: flex-start;
  }

  .search-form {
    box-sizing: border-box;
    background-color: var(--tidy-navigation);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 4px;
    position: relative;
    height: 34px;
    border: 1px solid var(--tidy-font-4);
    transition: width .2s;
    .search-input {
      border: none;
      width: calc(100% - 44px);
      padding: 7px 0 7px 12px;
      box-shadow: none;
      outline: none;
      font-size: 12px;
      color: var(--tidy-font-1);
      background-color: transparent;
      transition: width .3s;
    }
    .search-icon-container {
      position: relative;
      left: 0;
      width: 44px;
      height: 32px;
      background: var(--tidy-gray-2);
      border-radius: 2px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }

  .nav-item.add.creator-item {
    overflow: visible;
    width: 137px;
    padding-left: 5px;
  }
  .nav-item.add {
    cursor: default;
    width: 115px;
    transition: width .3s;
    overflow: hidden;
    padding-left: 0;
  }
  .nav-item.auth {
    color: #007fff;
    padding: 0;
    margin-left: .833rem;
    cursor: default;
  }
  .login-button-wrap {
    position: relative;
  }

  .nav-item:last-child {
    padding-right: 0;
  }
  .add-group {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    width: 115px;
    height: 36px;
  }

  .add-group .add-btn, .add-group .more {
    height: 100%;
    color: var(--tidy-font-white);
    background-color: var(--tidy-brand-1-normal);
    border-radius: 3px;
    transition: background-color .1s linear .05s;
    &.hide {
      background-color: transparent!important;
    }
  }

  .nav-item.add.hide {
    width: 0;
    padding: 0!important;
    overflow: hidden!important;
  }

  .add-group .add-btn {
    padding: 0 12px;
    font-size: 14px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    white-space: nowrap;
  }

  .add-group .add-btn:hover, .add-group .more:hover {
    background-color: var(--tidy-brand-2-hover);
  }

  .add-group .more {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    border-left: 1px solid hsla(0,0%,100%,.1);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    box-sizing: border-box;
  }

  .large-container {
    .index-nav {
      &::-webkit-scrollbar {
        background-color: transparent;
        width: 4px;
      }
      &::-webkit-scrollbar-thumb {
        border-radius: 4px;
        background-color: var(--tidy-component-hover);
      }
    }
  }

  .more-list {
    padding: 20px;
    .menu {
      display: flex;
      flex-wrap: wrap;
      .item {
        width: 72px;
        height: 72px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
        border-radius: 2px;
        cursor: pointer;
        &:hover {
          background: var(--tidy-gray-3);
        }
        .icon {
          width: 40px;
          height: 40px;
          background-position-x: center;
          background-position-y: center;
          &.article {
            background-image: url('@/assets/imgs/69704c654798bb27cffca68e5a79976e.svg');
          }
          &.drafts {
            background-image: url('@/assets/imgs/b1008fc20ddf1733b5bd800ed4bcc18e.svg');
          }
          &.res {
            background-image: url('@/assets/imgs/2e4856b20ddf1733b5bd800ed4bcc18e.svg');
          }
        }
        .title {
          font-size: 14px;
          line-height: 24px;
          color: var(--tidy-font-2);
        }
      }
    }
  }

  .action-list>.item, .action-list {
    display: flex;
    align-items: center;
  }

  .action-list>.item {
      position: relative;
      margin-right: 20px;
      font-size: 13px;
      line-height: 20px;
      /*color: var(--juejin-font-3);*/
      flex-shrink: 0;
      span {
        margin-left: 4px;
      }
  }

  .tag-list .tag, .tag-list {
    display: flex;
    align-items: center;
  }
  .tag-list {
    padding: 0 4px;
    .tag {
      position: relative;
      flex-shrink: 0;
      font-size: 13px;
      line-height: 22px;
      padding: 0 8px;
      color: var(--tidy-font-3);
      &:not(:last-child):after {
        position: absolute;
        right: -1px;
        display: block;
        content: " ";
        width: 2px;
        height: 2px;
        border-radius: 50%;
        background: var(--tidy-font-2);
      }
    }
  }

  .index-nav-before {
    display: none;
    .nav-list {
      width: 100%;
    }
  }

  .view-nav {
    position: fixed;
    top: 60px;
    width: 100%;
    height: 46px;
    z-index: 100;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%);
    transition: all .2s;
    transform: translateZ(0);
    &,&:before {
      left: 0;
      background-color: var(--tidy-navigation);
    }
    .nav-list {
      max-width: 960px;
      height: 100%;
      margin: auto;
      display: flex;
      align-items: center;
      line-height: 1;

      .nav-item {
        height: 100%;
        align-items: center;
        display: flex;
        flex-shrink: 0;
        font-size: 14px;
        color: var(--tidy-font-2);
        padding: 0 12px;
        &:hover,&.active {
          color: var(--tidy-font-brand1-normal);
        }
        &:first-child {
          padding: 0 12px 0 0;
        }
      }
    }
  }

  .category-popover-box {
    position: relative;
  }


  .unfold16-icon {
    fill: var(--tidy-font-brand1-normal);
    transform: rotate(
        0deg);
    transition: transform .2s ease-in-out;
    &.active {
      fill: #1e80ff;
      transform: rotate(-180deg);
    }
  }

  .phone-show-menu{
    cursor: pointer;
    display: none;
  }

  .mobile {
    display: none;
    width: 31px;
  }

  .large-container .index-nav-top {
    top: 20px!important;
    max-height: calc(100vh - 40px)!important;
  }

  .view-nav.top {
    transform: translate3d(0,-60px,0);
  }

  .sprite-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    vertical-align: middle;
    transition: all .15s linear;
  }

  .divider {
    width: 32px;
    background: var(--tidy-gray-1-1);
    height: 1px;
    margin: 0 auto 20px;
  }

  .article {
    img {
      max-width: 100%!important;
      height:auto!important;
    }
  }

  .tidy-avatar {
    display: inline-flex;
    position: relative;
    box-sizing: border-box;
    .avatar-img {
      border-radius: 50%;
      width: 100%;
      height: 100%;
      -o-object-fit: cover;
      object-fit: cover;
      background-color: var(--tidy-gray-3);
    }
  }

  .login-guide {
    width: 100%;
    height: 100%;
    background-color: var(--tidy-background);
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    color: var(--tidy-font-1);
    font-size: 15px;
    font-weight: 400;
    .login-guide-button {
      color: var(--tidy-brand-1-normal);
      font-weight: 500;
      cursor: pointer;
      margin: 0 4px;
    }
  }

  .limit-btn, .viewable{
    margin-top: 8px;
    cursor: pointer;
  }

  .limit-btn {
    font-size: 14px;
    line-height: 22px;
    color: #1e80ff;
  }

  .dislike-button .icon {
    font-weight: bolder;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    align-items: center;
    fill: var(--tidy-font-3);
    path {
      fill: var(--tidy-font-3);
    }
  }

  /** =======================
     响应式布局适配
   */
  @media screen and (min-width: 1351px) {
    .search-add-ul {
      width: 514px;
    }
    .search-form {
      width: 360px;
      &.active {
        width: 504px;
      }
    }
  }

  @media screen and (max-width: 1350px) {
    .search-form {
      width: 180px;
      &.active {
        width: 240px;
      }
    }
  }

  @media (max-width: 1220px) {
    .large-container main.container {
      max-width: 1000px!important;
    }
    .large-container .index-nav {
      display: none;
    }

    .index-nav-before, .tag-navigator {
      display: inherit;
    }
    .container .view.timeline-index-view {
      margin-top: 56px!important;
    }
    main.container .view-nav.web-only {
      display: none;
    }
  }

  @media (max-width: 1149px) {
    .logo {
      margin-right: 0;
    }
    .phone-hide {
      display: none!important;
      background-color: var(--tidy-navigation);
      box-shadow: 0 8px 24px rgb(81 87 103 / 16%);
      border: 1px solid var(--tidy-gray-1-1);
      border-radius: 4px;
      font-size: 14px;
      &.show {
          display: block!important;
          position: absolute;
          right: -48px;
          left: -51px;
          padding: 8px;
          width: 144px;
          top: 52px;
          .nav-item {
            &.link-item {
              a {
                &:not(.no-hover) {
                  width: 100%;
                  text-align: center;
                  padding: 0;
                }
                &:before{
                  display: none;
                }
              }
            }
          }
      }
    }
    .main-nav-list {
      display: block;
      position: absolute;
      left: 0;
      top: 0;
      background-color: var(--tidy-navigation);
      z-index: 1;
    }
    .phone-show-menu {
      height: 60px;
      display: flex;
      align-items: center;
      color: var(--tidy-font-brand1-normal);
      font-size: 15px;
      justify-content: center;
      padding: 0;
      width: 66px;
      span {
        margin-right: 5px;
      }
    }
    .right-side-nav {
      margin-right: 20px!important;
    }
    .nav-item {
      &.link-item {
        height: 48px;
      }
      &:hover>a {
        border-bottom: none;
      }
    }
    .search-add {
      margin-right: 3.5px;
    }
  }

  @media (max-width: 1000px) {
    .timeline-entry-list {
      margin: 0 auto!important;
      width: 95vw!important;
    }
    .aside {
      display: none;
    }


    // 文章，咨询详情页面
    .main-area {
      width: 100%;
      margin-bottom: 0;
    }
    .sidebar, article > .extension-banner {
      display: none!important;
    }
    .main-area.recommended-area .entry-list .entry, .main-area > * {
      padding-left: 24px!important;
      padding-right: 24px!important;
    }
    .main-area>.recommended-list-title-wrapper {
      border: none;
    }
  }

  @media (max-width: 980px) {
    .view-nav .nav-list {
      width: auto;
      overflow-x: auto;
      .nav-item:first-child, .nav-item:last-child {
        padding: 0 18px;
      }
    }
  }

  @media (max-width: 960px) {
    .suspension-panel {
      display: none!important;
    }
  }

  @media (max-width: 800px) {
    .auth .register {
      display:none;
    }
  }
  @media (max-width: 799px) {
    .nav-item.add {
      display: none;
    }
    .search-add {
      justify-content: flex-start!important;
      width: 270px;
      margin-left: 12px;
    }
    .nav-item.search {
      padding-left: 49.6px;
    }
    .nav-item.auth.hide, .nav-item.menu.hide, .nav-item.notification.hide {
      width: 0;
      padding: 0;
      overflow: hidden!important;
    }
  }

  @media (max-width: 640px) {
    .login-button-wrap {
        margin-right: 24px;
    }
    .right-side-nav {
      width: 322px;
      margin-right: 0!important;
      margin-left:0!important;
    }
    .search-add {
      margin-left: 0;
    }
    .nav-item {
      padding: 0 20px 0 12px;
    }
    .logo-img {
      display: none;
    }
    .mobile {
      display: block;
      height: 24px;
      color: var(--tidy-font-brand1-normal)
    }
    .nav-item .search-form {
      height: 32px;
      width: 140px;
      transition: width .1s linear 0s;
      &.active {
          width: 216px;
      }
    }
    .nav-item.search {
      padding-left: 128px!important;
    }
    .nav-item.search.active {
      padding-right: 16px;
      padding-left: 73.6px!important;
    }
    .search-add{
      margin-left: 0;
      &.active {
        margin-right: 24px;
      }
    }
    .search-add-ul {
      width: 272px!important;
    }
  }

  @media (max-width: 600px) {
    .large-container.container {
      max-width: 100vw!important;
    }

    .tag-list {
      top: auto!important;
      bottom: 12px!important;
      padding:0!important;
    }

    // 文章，咨询详情
    .suspended-panel {
      display: none!important;
    }
    .article-title {
      font-size: 24px!important;
    }
    .meta-box {
      font-size: 12px;
      line-height: 17px;
    }

    #comment-box {
      margin-top: 8px;
    }
    .action-box .emoji-btn {
      display: none!important;
    }
    .avatar-box {
      display: none!important;
    }
    .user-link .avatar {
      width: 28px!important;
      height: 28px!important;
    }
    .content-box .user-box .username .name {
      max-width: 114px!important;
    }
  }
</style>
